package com.security.demo.controller;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author  zwj
 * @date    2020/08/19
 * @version 1.0
 */
@RestController
@RequestMapping("/task")
public class TaskController{

    @GetMapping("/zwj")
    public JSONObject listTasks(){
        System.out.println("1111");
        JSONObject jsonObject=new JSONObject();
        jsonObject.put("zwj","lovejly");
        return jsonObject;
    }

    @PostMapping
    public String newTasks(){
        return "创建了一个新任务";
    }

    @PutMapping("/{taskId}")
    public String updateTasks(@PathVariable("taskId") Integer id){
        return "更新了一下id为："+id+"的任务";
    }

    @DeleteMapping("/{taskId}")
    public String deleteTasks(@PathVariable("taskId") Integer id){
        return "删除了id为:"+id+"的任务";
    }
}
